CPUIDLE: enable MSI capable HPET for timer broadcast
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 20 Mar 2009 12:33:55 +0000 (12:33 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 20 Mar 2009 12:33:55 +0000 (12:33 +0000)
commit3ba523ff957c0478665541faf061962ca3c2b82f
tree0177c3a0d01763db23880540d5b07af1122cc2b5
parent5534b7d9866f754c269ba33c7602d93cc4ff9ecd
CPUIDLE: enable MSI capable HPET for timer broadcast

The HPET broadcast was default not enabled because the old code use
HPET channel 0 in legacy replacing mode which will hide both PIT & RTC
irqs and cause issues if RTC is needed in some cases. The upstream
default broadcast timer is PIT, which is in periodic mode (100HZ) and
would be expensive to be used as oneshot. MSI capable HPET is coming
into being. It is capable to deliver interrupt through FSB directly,
and has no side effect.

This patch extends support for MSI HPET based on original legacy HPET
code. The broadcast timer selection logic becomes: 1. if MSI capable HPET
available, use multiple HPET channels (no more than possible cpu num)
in MSI mode; 2. else if legacy replacing mode available for HPET &
'hpetbroadcast' option is given in cmd line, use HPET channel 0 in
legacy mode; 3 else use PIT.

While entering broadcast, it gets a hpet channel (look for a spare one
first, if failing allocate a shared one), attach to current cpu, setup
the irq affinity & broadcast cpumask. While exiting broadcast, it
detach the used hpet channel and try to change the owner if the
broadcast mask is not empty. Some optimizations(static affinity) were
done for (MSI HPET channels >= possible cpu num) case.

A new hw_interrupt_controller 'HPET_MSI' is created for HPET MSI
interrupt handling.

Signed-off-by: Wei Gang <gang.wei@intel.com>=
xen/arch/x86/hpet.c
xen/arch/x86/msi.c
xen/arch/x86/time.c
xen/include/asm-x86/hpet.h